<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>我要报修</title>
    <link href="../../../css/common.css" rel="stylesheet"/>
    <link href="../../../css/mui.min.css" rel="stylesheet"/>
    <script src="../../../js/vue.min.js"></script>
    <script src="../../../js/mui.min.js"></script>
    <script src="../../../js/fastclick.js"></script>
    <script src="../../../js/api.js"></script>
    <script src="../../../js/common.js"></script>
    <script src="../../../js/vue-common.js"></script>
    <style>
        html, body, #app {
            height: 100%;
            overflow: hidden;
        }

        .search-box {
            width: 90%;
            margin: 1rem auto 0;
        }

        .search-box input {
            margin-top: 1rem;
            border: none;
            background-color: #F3F3F3;
            border-radius: 2rem;
            font-size: 1.4rem;
            padding: 1rem;
            text-align: center;
            color: #333;
        }

        .search-box p {
            text-align: right;
            font-size: 1.2rem;
            color: #65c459;
        }

        .next {
            width: 65% !important;
        }
    </style>
</head>
<body>
<div id="app">
    <div class="header-nav">
        <span>新增</span>
        <div class="icon"><img src="../../../img/common/btn_back.png" alt=""></div>
    </div>

    <div class="container xl-bg-white top">
        <div class="search-box">
            <input v-model="code" style="text-align: left;padding: 0 3rem" type="text" placeholder="请输入机具编号">
        </div>

        <div @click="goNext" class="xl-btn normal next no-shadow">下一步</div>

        <xlb-modal v-model="tipMod">
            <div class="dialog-content" slot="content">该机具编号已经存在， 是否继续？</div>
            <div slot="footer-left">取消</div>
            <div @click="goAddPage" slot="footer-right">继续</div>
        </xlb-modal>
    </div>
</div>
<script>
    var vm = new Vue({
        el: '#app',
        data: {
            code: '',
            tipMod: false,
            tipContent: '',
            type: '' // 保修类型 1 工程师， 2 故障确认
        },
        methods: {
            // 跳转故障详情
            goNext: function () {
                if (!this.code) {
                    return mui.toast("请输入机具编号")
                }
                // 查询机具信息
                Resource.get(QING_FEN_GET_ORDER_BILL, {code: this.code}, function (res) {
                    setItem('qingfenInfo',res);
                    //  弹出提示
                    if (res.clearBillInfoMap && Object.getOwnPropertyNames(res.clearBillInfoMap).length > 0) {
                        return vm.tipMod = true;
                    }
                    // 跳转详情
                    return redirect('pages/order/qingfen/addQinfenOrder.html');

                })
            },
            goAddPage: function () {
                // 跳转详情
                redirect('pages/order/qingfen/addQinfenOrder.html');
                setTimeout(function () {
                    vm.code = '';
                    vm.tipMod = false;
                }, 1000)
            }
        }
    });


</script>
</body>
</html>
